﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NAnt.Core;

namespace NAnt.SVN.Tasks
{
    /// <summary>
    /// Base task class to enable unit testing
    /// on the core functionalities of the task 
    /// without a NAnt Project context
    /// $Id$
    /// </summary>
    public class BaseExtensionTask : Task
    {
        #region Private Fields

        ISVNTaskLogger logginginstance;
        IPropertiesManager propertiesmanager;

        #endregion

        #region Public Fields

        /// <summary>
        /// Log a message to the base project
        /// </summary>
        /// <param name="messageLevel"></param>
        /// <param name="message"></param>
        internal void LogToProject(Level messageLevel, string message)
        {
            base.Log(messageLevel, message);
        }

        /// <summary>
        /// The logging instance who passes the message. 
        /// </summary>
        public virtual ISVNTaskLogger LoggingInstance
        {
            get
            {
                if (logginginstance == null)
                    logginginstance = new NantSVNTaskLogger(this);
                return logginginstance;
            }
            set
            {
                logginginstance = value;
            }
        }

        /// <summary>
        /// The properties manager to communicate with the properties stack.
        /// </summary>
        public virtual IPropertiesManager PropertiesManager
        {
            get
            {
                if (propertiesmanager == null)
                    propertiesmanager = new Util.PropertiesManager(this);
                return propertiesmanager;
            }
            set
            {
                propertiesmanager = value;
            }
        }

        #endregion

        protected override void ExecuteTask()
        {
            throw new NotImplementedException();
        }
    }
}
